/* 
 * File:   MyBatchUnitModel.h
 * Author: Morpheus
 *
 * Created on 20 juin 2013, 23:40
 */

#ifndef MYBATCHUNITMODEL_H
#define	MYBATCHUNITMODEL_H

#include <QtCore/qabstractitemmodel.h>

#include "MyBatchMerge.h"

class MyBatchUnitModel : public QAbstractTableModel {
    Q_OBJECT
public:
    MyBatchUnitModel(QObject* parent = 0);
    virtual ~MyBatchUnitModel();
    
    MyBatchMerge getBatchMerge() const;
    void setBatchMerge(const MyBatchMerge& data);
    
    MyBatchUnit getBatchUnit(const QModelIndex& index) const;
    void insertBatchUnit(const int& i, const MyBatchUnit&);
    void removeBatchUnit(const QModelIndex& index);
    bool goUpBatchUnit(const QModelIndex& index);
    bool goDownBatchUnit(const QModelIndex& index);
    
    QString getCurrUnit() const;
    void setCurrUnit(const QString&);
    
    bool isModified() const;
    void setModified(const bool&);

    void setDoWithSuccess(const bool&);
    
    virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
    virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
    
public Q_SLOTS:
    void setName(const QString& );
    void setSaveFilePatern(const QString& );
    void setSaveFileFormat(const QString& );
    
Q_SIGNALS:
    void saveFile(const QString&, const bool&);
    void modified(const bool&);
    
private:
    MyBatchMerge m_data;
    QString m_currUnit;
    QString m_saveFile;
    bool m_modified;

};

#endif	/* MYBATCHUNITMODEL_H */

